Consider the following pseudocode function n 0 Compute the

Consider the following pseudocode function.

n > 0

Compute the values returned by the following function calls. (a)    W(10) =

(b)    W(?20) =

(c)    W(5) =

function W(n \"isZ)
     if

n > 0

then
     \"beginloop.gif\" if n is odd then
          return 2n
else
\"endloop.gif\" return n + 1
else
return n ? 1
Consider the following pseudocode function. Compute the values returned by the following function calls. (a) W(10) = (b) W(?20) = (c) W(5) =

Solution

a) if W(10) where n>0 and even then retun n+1 that mean 10+1 = 11 this is the final answer.

b) if W(?20) then tha case is else so the return would be n?1 which is ?20?1 this is the final answer.

C) if W(5 ) then n>0 and odd then return 2n which is 2*5 = 10 this is the final answer.

Consider the following pseudocode function. n > 0 Compute the values returned by the following function calls. (a) W(10) = (b) W(?20) = (c) W(5) = function W

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site